//
//  loginPageViewController.m
//  翻转效果
//
//  Created by Lucifer on 15-5-18.
//  Copyright (c) 2015年 xuxzhou. All rights reserved.
//

#import "loginPageViewController.h"
#import "UIButton+Helper.h"
#import "UIView+Helper.h"
#import "UILabel+Helper.h"
#import "UIColor+Helper.h"
@interface loginPageViewController ()<UITextFieldDelegate>
@property (nonatomic, strong) UITextField* userTextField;
@property (nonatomic, strong) UITextField* keyTextField;
@property (nonatomic, strong) UIButton* loginButton;
@property (nonatomic, strong) UIButton* forgetKeyButton;
@end

@implementation loginPageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title=@"登录登录";
    self.view.backgroundColor=[UIColor mainColor];
    
    [self buildUI];
    
    
    
}

- (void)buildUI
{
    
    _userTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, CGRectGetHeight(self.view.frame)*0.25, self.view.frame.size.width-40, 49)];
    _userTextField.backgroundColor = [UIColor clearColor];
    _userTextField.placeholder = @"用户名或者邮箱";
    _userTextField.delegate = self;
    _userTextField.autocapitalizationType = UITextAutocapitalizationTypeNone;
    _userTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
    
    _keyTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, _userTextField.maxY + 1, self.view.frame.size.width-40, _userTextField.frame.size.height)];
    _keyTextField.placeholder = @"密码";
    _keyTextField.delegate = self;
    _keyTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
    _keyTextField.secureTextEntry = YES;
    _keyTextField.backgroundColor = [UIColor clearColor];
    
    _loginButton = [UIButton buttonWithFrame:CGRectMake(0, _keyTextField.maxY + 30, (CGFloat)(self.view.frame.size.width * 0.86), 40) color:[UIColor clearColor] highlightColor:[UIColor color646464] cornerRadius:5 titleFont:18 titleColor:[UIColor whiteColor] Title:@"登陆"];
    _loginButton.layer.borderColor=[[UIColor whiteColor]CGColor];
    _loginButton.layer.borderWidth=0.5;
    _loginButton.center = CGPointMake(self.view.center.x, _loginButton.center.y);
    [_loginButton addTarget:self action:@selector(loginButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel* lineLabel1 = [UILabel XaddLineLabel:[UIColor colore1e1e1] frame:CGRectMake(0, _userTextField.maxY, self.view.frame.size.width, 1)];
    UILabel* lineLabel2 = [UILabel XaddLineLabel:[UIColor colore1e1e1] frame:CGRectMake(0, _keyTextField.maxY, self.view.frame.size.width, 1)];
    
    _forgetKeyButton = [UIButton buttonWithFrame:CGRectMake(0, _loginButton.maxY + 12, 80, 18) title:@"忘记密码？" titleColor:[UIColor color646464] titleFont:[UIFont systemFontOfSize:14] image:nil backGroundColor:[UIColor clearColor] backGroundImage:nil];
    [_forgetKeyButton addTarget:self action:@selector(forgetKeyButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    _forgetKeyButton.center = CGPointMake(self.view.center.x, _forgetKeyButton.center.y);
    [self.view addSubview:_forgetKeyButton];
    
    [self.view addSubview:lineLabel1];
    [self.view addSubview:_userTextField];
    [self.view addSubview:lineLabel2];
    [self.view addSubview:_keyTextField];
    [self.view addSubview:_loginButton];
}

- (void)loginButtonClicked
{
    
}
-(void)forgetKeyButtonClicked{


}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
  [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
